#include <iostream>
using namespace std;

int main()
{
    int num = 0;
    while (cin >> num && num != -1)
    {
        int Time = 0;
        int distance = 0;
        for (int i = 0; i < num; i++)
        {
            int speed;
            int totalTime = 0;
            cin >> speed >> totalTime;
            distance += speed * (totalTime - Time);
            Time = totalTime;
        }
        cout << distance << " miles" << endl;
    }
    return 0;
}